import 'package:backend.core/core/domain/entities/api/web/api_web_one_time_purchased_item_transaction.dart';
import 'package:backend.core/core/domain/entities/api/web/yookassa/api_yookassa_one_time_purchased_item_transaction.dart';
import 'package:backend.purchases/infrastructure/dtos/api/web/api_web_one_time_purchased_item_transaction_dto.dart';
import 'package:backend.purchases/infrastructure/dtos/api/web/yookassa/api_yookassa_one_time_purchased_item_transaction_dto.dart';

class ApiWebOneTimePurchasedItemTransactionDtoFactory {
  const ApiWebOneTimePurchasedItemTransactionDtoFactory._internal();

  static const _instance = ApiWebOneTimePurchasedItemTransactionDtoFactory._internal();

  factory ApiWebOneTimePurchasedItemTransactionDtoFactory() {
    return _instance;
  }

  ApiWebOneTimePurchasedItemTransactionDto fromEntity(
      ApiWebOneTimePurchasedItemTransaction transaction) {
    if (transaction is ApiYookassaOneTimePurchasedItemTransaction) {
      return ApiYookassaOneTimePurchasedItemTransactionDto.fromEntity(transaction);
    }

    throw UnimplementedError();
  }
}
